package com.example.administrator.yuejian23.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.yuejian23.Bean.ClubCourse;
import com.example.administrator.yuejian23.R;

import java.util.List;

/**
 * Created by Administrator on 2017/10/10.
 */

public class ClubVideoAdapter extends RecyclerView.Adapter {

    private List courseList;
    private LayoutInflater layoutInflater;
    private Context context;

    public ClubVideoAdapter(Context context,List courseList){
        this.context=context;
        this.courseList=courseList;
    }


    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View itemView=LayoutInflater.from(context).inflate(R.layout.item_club_video,viewGroup,false);
        ClubVideoViewHolder holder=new ClubVideoViewHolder(itemView);
        return holder;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {

        ClubVideoViewHolder clubVideoViewHolder= (ClubVideoViewHolder) viewHolder;
        ClubCourse.ClubcourseEntity entity= (ClubCourse.ClubcourseEntity) courseList.get(position);
        String name=entity.getCourse_name();
        String cclass=entity.getBmnotice();
        String price=entity.getCourse_price();

        clubVideoViewHolder.course_name.setText(name);
        clubVideoViewHolder.course_class.setText(cclass);
        clubVideoViewHolder.course_price.setText(price);


    }

    @Override
    public int getItemCount() {
        return courseList.size();
    }


    public class ClubVideoViewHolder extends RecyclerView.ViewHolder {

        public TextView course_name;
        public TextView course_class;
        public TextView course_price;
        public View itemView;

        public ClubVideoViewHolder(View itemView) {
            super(itemView);
            this.itemView=itemView;
            course_name=(TextView) itemView.findViewById(R.id.club_course_name);
            course_class= (TextView) itemView.findViewById(R.id.club_course_class);
            course_price= (TextView) itemView.findViewById(R.id.club_course_price);
        }
    }

}

